#include <iostream>
using namespace std;
using ll=long long int;
const int N=105;
ll grid[N][N];
ll sum[N][N];
ll n;
ll ret=-0x3f3f3f3f3f3f3f3f;
int main() 
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            cin>>grid[i][j];
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+grid[i][j];
        }
    }
    for(int x=1;x<=n;x++)
    {
        for(int y=1;y<=n;y++)
        {
            for(int x1=x;x1<=n;x1++)
            {
                for(int y1=y;y1<=n;y1++)
                {
                     ll area=sum[x1][y1]-sum[x1][y-1]-sum[x-1][y1]+sum[x-1][y-1];
                    ret=max(ret,area);
                }
            }
        }
    }
   
    cout<<ret<<endl;
}
// 64 位输出请用 printf("%lld")